package com.example.demo.common.util;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

/**
 * 自定义返回值类型
 * @Author: 王文龙
 * @Date: 2020/6/1915:12
 * @Version: 1.0
 * @Describe: 描述:
 */
public class JsonResultT<T> implements Serializable {

    private int code;
    private String msg;
    private T date;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Integer total;

    public JsonResultT() {
    }

    public JsonResultT(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public JsonResultT(int code, String msg, T date) {
        this.code = code;
        this.msg = msg;
        this.date = date;
    }

    public JsonResultT(int code, String msg, T date, Integer total) {
        this.code = code;
        this.msg = msg;
        this.date = date;
        this.total = total;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getDate() {
        return date;
    }

    public void setDate(T date) {
        this.date = date;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return "JsonResultT{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", date=" + date +
                ", total=" + total +
                '}';
    }
}
